#!/bin/bash
load_configuration
ftp_tmp_dir="$ftp_dir.tmp.$RANDOM"

$lftp_command <<END_SCRIPT
  $ftp_config
  echo "Logging in to ftp://$ftp_username@$ftp_host"
  open $ftp_host
  user $ftp_username $ftp_password
  mv $ftp_dir $ftp_tmp_dir
  mv $ftp_swap_dir $ftp_dir
  mv $ftp_tmp_dir $ftp_swap_dir
  echo "DEPLOYED"
  bye
END_SCRIPT

rm -rf $tmp_dir
exit 0

